﻿using Application.UserApp.Dtos;
using Domain.Entities;
using System;
using System.Collections.Generic;
using System.Text;

namespace Application.UserApp
{

    public interface IUserAppService
    {
        /// <summary>
        /// 登陆检测
        /// </summary>
        /// <param name="userName">登录名</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        User CheckUser(string userName, string password);

        /// <summary>
        /// 获取所有User
        /// </summary>
        /// <param name="key">关键字</param>
        /// <returns></returns>
        List<User> GetAll(string key);
        List<User> GetAll(int roleid);

        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="SearchKeyWords">查询关键字</param>
        /// <param name="PageSize">页面输出信息行数</param>
        /// <param name="PageCurrent">当前页数</param>
        /// <param name="OrderField">排序字段</param>
        /// <param name="OrderDirection">排序</param>
        /// <returns></returns>
        List<User> GetPageList(string SearchKeyWords, int PageSize, int PageCurrent, string OrderField, bool OrderDirection = true);

        /// <summary>
        /// 根据ID获取
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        User GetById(int id);

        /// <summary>
        /// 根据ID是否存在，新增或修改
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        bool AddOrUpdate(User model);

        /// <summary>
        /// 根据loginname获取
        /// </summary>
        /// <param name="loginname"></param>
        /// <returns></returns>
        User GetByLoginname(string loginname);

        /// <summary>
        /// 根据ID删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        bool DeleteById(int id);
    }
}
